<?php 
function login_mod ($user, $pass){
	$a="SELECT * FROM user WHERE user='$user' AND pass='$pass'";
	$b=mysql_query($a) or die('ERROR:'.mysql_error());
	return mysql_num_rows($b) >= 1 ? mysql_fetch_array($b, MYSQL_ASSOC) : FALSE;
}
function change_mod($pass){
	$user=$_SESSION['user'];
	$new_pass=$_REQUEST['pass'];
	$pass_check=$_REQUEST['pass_check'];
	$e="UPDATE user SET `pass`='$new_pass' WHERE user='$user'";
	mysql_query($e) or die('ERROR:' .mysql_error());
	return mysql_affected_rows() >=1 ? TRUE: FALSE;
}
function edit_info($contact, $email){
	$user=$_SESSION['user'];
	$email=$_REQUEST['email'];
	$contact=$_REQUEST['contact'];
	$g="UPDATE user SET `contact`='$contact', `email`='$email' WHERE user='$user'";
	mysql_query($g) or die('ERROR:'.mysql_error());
	return mysql_affected_rows() >=1 ? TRUE: FALSE;
	}
//end of user//
//start of admin//
function admin_mod ($user, $pass){
	$c="SELECT * FROM admin WHERE user='$user' AND pass='$pass' AND admin_level='Administrator'";
	$d=mysql_query($c) or die('ERROR:' .mysql_error());
	return mysql_num_rows($d) >= 1 ? mysql_fetch_array($d, MYSQL_ASSOC) : FALSE;
}
function edit_admin($contact, $email_add){
	$admin_id=$_SESSION['admin_id'];
	$user=$_SESSION['user'];
	$contact=$_REQUEST['contact'];
	$email_add=$_REQUEST['email_add'];
	$query="UPDATE admin SET `contact`='$contact', `email_add`='$email_add' WHERE user='$user'";
	mysql_query($query) or die('ERROR:'.mysql_error());
	return mysql_affected_rows() >=1 ? TRUE: FALSE;
	}
function admin_change($pass){
	$user=$_SESSION['user'];
	$new_pass=$_REQUEST['pass'];
	$pass_check=$_REQUEST['pass_check'];
	$query="UPDATE admin SET `pass`='$new_pass' WHERE user='$user'";
	mysql_query($query) or die('ERROR:' .mysql_error());
	return mysql_affected_rows() >=1 ? TRUE: FALSE;

}
//start of super admin//
function super_mod ($user, $pass){
	$c="SELECT * FROM admin WHERE user='$user' AND pass='$pass' AND admin_level='Super Administrator'";
	$d=mysql_query($c) or die('ERROR:' .mysql_error());
	return mysql_num_rows($d) >= 1 ? mysql_fetch_array($d, MYSQL_ASSOC) : FALSE;
}
function super_change($pass){
	$user=$_SESSION['user'];
	$new_pass=$_REQUEST['pass'];
	$pass_check=$_REQUEST['pass_check'];
	$query="UPDATE admin SET `pass`='$new_pass' WHERE user='$user' AND admin_level='Super Administrator'";
	mysql_query($query) or die('ERROR:' .mysql_error());
	return mysql_affected_rows() >=1 ? TRUE: FALSE;

}

?>